package com.mtable.service.impl;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mtable.base.BaseServiceImpl;
import com.mtable.dao.MMenuDao;
import com.mtable.entity.MMenu;
import com.mtable.service.MMenuService;
@Service
public class MMenuServiceImpl extends BaseServiceImpl<MMenu> implements MMenuService{
	@Autowired
	public MMenuServiceImpl(MMenuDao mMenuDao){
		super(mMenuDao);
	}
	
	@Autowired
	private MMenuDao mMenuDao;
	
	public String getAllMenuItemJsonStr(){
		List<MMenu> menuList = mMenuDao.findAll();
		if( menuList.size() < 0 ){
			return "";
		}
		JSONObject jobj;
		JSONArray jarry = new JSONArray();
		for(MMenu mu : menuList){
			jobj = new JSONObject(mu);
			jarry.put(jobj);
		}
		return jarry.toString();
	}
}
